package ProPerties_;

import java.io.*;
import java.util.Properties;

public class Properties02 {
    public static void main(String[] args) throws IOException {
        //使用Properties类来读取mysql.priperties文件
        //创建对象
        Properties properties = new Properties();
        //加载配置文件
        //properties.load(new FileReader("src\\mysql.properties"));
//        ClassLoader classLoader = Properties02.class.getClassLoader();
//        InputStream is = classLoader.getResourceAsStream("mysql.properties");
        properties.load(Properties02.class.getClassLoader().getResourceAsStream("mysql.properties"));
        String user = properties.getProperty("user");
        System.out.println(user);
        // properties.load(is);
        //把k-v显示
      properties.list(System.out);
//        System.out.println(">>>>>>>>>>>>>>>");
//        properties.load(new FileInputStream("src\\mysql.properties"));
//        ;
//        properties.list(System.out);
    }
}
